

package jetbrains.buildServer.server.rest.errors;

import com.sun.jersey.api.ParamException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import jetbrains.buildServer.server.rest.jersey.ExceptionMapperBase;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

@Provider
@Component
public class JerseyParamExceptionExceptionMapper extends ExceptionMapperBase<ParamException> {
  @Override
  public ResponseData getResponseData(@NotNull final com.sun.jersey.api.ParamException e) {
    return new ResponseData(Response.Status.BAD_REQUEST, "Error processing request parameter '" + e.getParameterName() + "'. Check supported formats.");
  }
}